<?php /* @var $myanswers sfPropelPager */;?>
<?php /* @var $answer StatementAnswer */;?>
<div class="tabbed">
	<ul class="tabs">
		<li id="tab-myprofile_mystatements" class="tab<?php echo $active_tab == 'statements' ? ' active' : ''?>">my statements</li>
		<li id="tab-myprofile_mydebates" class="tab<?php echo $active_tab == 'debates' ? ' active' : ''?>">my debates</li>
	</ul>

	<div id="myprofile_mystatements" class="content<?php echo $active_tab == 'debates' ? ' hide' : ''?>">
		<ul>
		<?php foreach($myanswers->getResults() as $answer): ?>
			<li class="group debate debate-<?php echo $answer->getLypoStatement()->getId()?>">
				"<?php echo $answer->getLypoStatement()->getText()?>"
				<?php if ($answer->getAnswer() == 'c'): ?>
					<span class="vote-no vote-no-active debate-<?php echo $answer->getLypoStatement()->getId()?>">I disagree</span>
				<?php else: ?>
					<span class="vote-no debate-<?php echo $answer->getLypoStatement()->getId()?>">I disagree</span>
				<?php endif; ?>

				<?php if ($answer->getAnswer() == 'a'): ?>
					<span class="vote-yes vote-yes-active debate-<?php echo $answer->getLypoStatement()->getId()?>">I agree</span>
				<?php else: ?>
					<span class="vote-yes debate-<?php echo $answer->getLypoStatement()->getId()?>">I agree</span>
				<?php endif; ?>
			</li>
		<?php endforeach; ?>
		</ul>

		<?php if($myanswers->haveToPaginate()): ?>
		<p class="group" style="margin-bottom: 0">
			<?php if($myanswers->getPreviousPage() < $myanswers->getPage()): ?>
				<?php echo link_to('previous five','myprofile/mystatements?userid='.$userid.'&active=statements&statement_page='.$myanswers->getPreviousPage(),'class=prevlink'); ?>
			<?php endif; ?>
			<?php if($myanswers->getNextPage() > $myanswers->getPage()): ?>
				<?php echo link_to('next five','myprofile/mystatements?userid='.$userid.'&active=statements&statement_page='.$myanswers->getNextPage(),'class=nextlink'); ?>
			<?php endif; ?>
		</p>
		<?php endif; ?>
	</div>

	<div id="myprofile_mydebates" class="content<?php echo $active_tab == 'statements' ? ' hide' : ''?>">
		<?php if($mydebatereactions && count($mydebatereactions)): ?>
			<ul>
			<?php foreach($mydebatereactions->getResults() as $reaction): ?>
				<li class="group">
					<span class="statement debate debate-<?php echo $reaction->getLypoStatement()->getId()?>">"<?php echo $reaction->getLypoStatement()->getText()?>"</span>
					<?php if ($myanswer_ids[$reaction->getStatementId()] == 'a'): ?>
						<span class="vote-yes-active">I agree</span>
					<?php elseif ($myanswer_ids[$reaction->getStatementId()] == 'c'): ?>
						<span class="vote-no-active">I disagree</span>
					<?php endif;?>
					<span class="debate debate-<?php echo $reaction->getLypoStatement()->getId()?>">Go to debate</span>
				</li>
			<?php endforeach; ?>
			</ul>

			<?php if($mydebatereactions->haveToPaginate()): ?>
			<p class="group">
				<?php if($mydebatereactions->getPreviousPage() < $mydebatereactions->getPage()): ?>
					<?php echo link_to('previous five','myprofile/mydebates?userid='.$userid.'&active=debates&debate_page='.$mydebatereactions->getPreviousPage(),'class=prevlink'); ?>
				<?php endif; ?>
				<?php if($mydebatereactions->getNextPage() > $mydebatereactions->getPage()): ?>
					<?php echo link_to('next five','myprofile/mydebates?userid='.$userid.'&active=debates&debate_page='.$mydebatereactions->getNextPage(),'class=nextlink'); ?>
				<?php endif; ?>
			</p>
			<?php endif; ?>
		<?php else: ?>
			<p>You didn't comment on any debates yet!</p> 
		<?php endif; ?>
	</div>
</div>